<template>
	<view class="w-100">
		<view class="flex-1 mt-8 mx-5">
			<view class=""><text class="mr-2 text-muted font-s-3">会员:</text>{{ distriDetail.user_name }}</view>
			<view class="mt-4"><text class="mr-2 text-muted font-s-3">我的上级:</text>{{ distriDetail.leader_name }}
			</view>
			<view class="mt-4 row-ac">
				<view class=""><text class="mr-2 text-muted font-s-3">我的邀请码:</text>{{ distriDetail.mark_id }}</view>
				<view class="ml-5" @click="copyText(distriDetail.mark_id)">复制</view>
			</view>
			<view class="mt-4"><text class="mr-2 text-muted font-s-3">申请时间:</text>{{ distriDetail.create_time }}
			</view>
		</view>
	</view>
</template>

<script>
	import {
		userInfoUrl,
	} from '@/api/index.js';
	import {
		distributorsDetailUrl,
		distributorsListUrl
	} from '@/api/index.js'
	export default {
		data() {
			return {
				distriDetail: ''
			}
		},
		mounted() {
			this.token = uni.getStorageSync('token')
			if (this.token != '') {
				this.loginStatus = true
				this.getUserInfo()
			} else {
				this.loginStatus = false
			}
		},
		methods: {
			getUserInfo() {
				this.$R.get(userInfoUrl).then(res => {
					this.userInfo = res.data
					this.getDistributorsDetail(this.userInfo.id)
				})
			},
			getDistributorsDetail(userId) {
				this.$R.get(distributorsDetailUrl + userId + '/').then(res => {
					this.distriDetail = res.data
					console.log('2222', this.distriDetail);
				})
			},
			copyText(markId) {
				uni.setClipboardData({
					data: markId,
					success: function() {
						uni.showToast({
							title: "复制成功",
							duration: 2000
						})
					}
				});
			}
		}
	}
</script>

<style>
</style>